<?php
// Tim'Roster
// Copyright (c) 2011 Nicolas Nallet <aspgic2@gmail.com>
//
// This file is part of Tim'Roster.
//
// Tim'Roster is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Tim'Roster is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

$xml_config = simplexml_load_file('config.xml');

include_once($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/technical_class/language/language.php');
include_once ($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/render/render_guild.php');
include_once ($_SERVER["DOCUMENT_ROOT"].$xml_config->roster_root_directory.'/render/render_menu.php');

$menu_guild = new Guild();

if ((isset($_SESSION['guild_id'])) && (is_numeric($_SESSION['guild_id']))){
    $menu_guild = Guild::get_guild_light($_SESSION['guild_id']);
}
else {
    $menu_guild = Guild::get_primary_guild_light();
}

if (isset($menu_guild)) {
    $_SESSION['guild_id'] = $menu_guild->get_id();
}
else {
    $_SESSION['guild_id'] = null;
}

echo render_new_menu($menu_guild);

?>

